<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js加载时间线</title>
</head>
<body>

    <div style="width: 100px;height: 100px;background-color: red"></div>
    <script>
        console.log(document.readyState);//loading
        document.onreadystatechange = function () {
            console.log(document.readyState);
            //interactive
            //complete
        };
        //DOMContentLoaded 只在addEventListener上可以使用  文档解析完执行
        document.addEventListener('DOMContentLoaded',function () {
            console.log("a");
        },false)
    </script>
</body>
</html>
